module.exports = function access(socket, content, key){
  let id = socket.id
  if(key === 'entry'){
    this.users.add(id)
    content += '加入'
  //防止离开房间的人，刷新再次出发
  } else if(this.users.has(id)){
    this.users.delete(id)
    content += '离开'
  } else {
    return
  }
  socket.broadcast.emit(key, {
    id,
    userName: '系统',
    content: `${content}了冲浪`,
    createAt: new Date(),
    type: 'sys',
  });
  //在线人数
  this.io.emit('onLine', {
    number: this.users.size
  })
}